<html>
<head><meta charset="utf-8"><title>global_asm with format_specifiers · project-inline-asm · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/index.html">project-inline-asm</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html">global_asm with format_specifiers</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224494126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224494126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224494126">(Jan 29 2021 at 16:11)</a>:</h4>
<p>Wouldn't it be cool if global_asm!() had the option to pass symbols/consts into it, like we can with inline_asm!?</p>



<a name="224494213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224494213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224494213">(Jan 29 2021 at 16:11)</a>:</h4>
<p>I'd love to do that but I just haven't had the time to implement it.</p>



<a name="224494229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224494229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224494229">(Jan 29 2021 at 16:11)</a>:</h4>
<p>Do you want to have a go at it?</p>



<a name="224494634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224494634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224494634">(Jan 29 2021 at 16:14)</a>:</h4>
<p>There's a few issues with implementing it myself. I could at least start by making an issues, if there isn't one.</p>



<a name="224494669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224494669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224494669">(Jan 29 2021 at 16:14)</a>:</h4>
<p>Sure, go ahead.</p>



<a name="224494869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224494869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224494869">(Jan 29 2021 at 16:15)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> how big of an task do you think it would be? I assume a lot of the code could be shared by inline_asm handling</p>



<a name="224497391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224497391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224497391">(Jan 29 2021 at 16:31)</a>:</h4>
<p>I can maybe offer a small (tiny) bounty. it is for my personal/hobby code, but it would be really nice to have</p>



<a name="224497759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224497759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224497759">(Jan 29 2021 at 16:33)</a>:</h4>
<p>It shouldn't be too difficult. The hard part is figuring out how to flow the global_asm along with the constants and symbols through the various stages of rustc (AST, HIR, MIR, etc).</p>



<a name="224497851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224497851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224497851">(Jan 29 2021 at 16:33)</a>:</h4>
<p>I'd say maybe a few days to a week if you work on it full time.</p>



<a name="224497944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224497944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224497944">(Jan 29 2021 at 16:34)</a>:</h4>
<p>But then again I am bad at estimating these things.</p>



<a name="224498998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224498998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224498998">(Jan 29 2021 at 16:40)</a>:</h4>
<p>Well, I hope someone can look at it eventually!</p>



<a name="224499134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224499134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224499134">(Jan 29 2021 at 16:41)</a>:</h4>
<p>I'm not sure how much a bounty would help, there's been a bounty up for a while for PowerPC support for <code>asm!</code> but nobody's taken it up.</p>



<a name="224499351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224499351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224499351">(Jan 29 2021 at 16:43)</a>:</h4>
<p>Probably not, but worth trying :-)</p>



<a name="224650848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224650848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224650848">(Jan 31 2021 at 15:51)</a>:</h4>
<p>It seems like this isn't implementable with current LLVM. the module asm feature doesn't seem to support substitutions like inline asm does :/</p>



<a name="224650903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224650903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224650903">(Jan 31 2021 at 15:52)</a>:</h4>
<p>You need to substitute the symbol name in rustc, before passing the assembly string to LLVM.</p>



<a name="224650917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224650917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224650917">(Jan 31 2021 at 15:53)</a>:</h4>
<p>yeah, so it would need extra work there compared to inline asm</p>



<a name="224650921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224650921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224650921">(Jan 31 2021 at 15:53)</a>:</h4>
<p>inline asm already does this to some extent.</p>



<a name="224650929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224650929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224650929">(Jan 31 2021 at 15:53)</a>:</h4>
<p>oh, I just looked at a random line of inline asm I had, and noticed it wasnt doing it</p>



<a name="224650930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224650930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224650930">(Jan 31 2021 at 15:53)</a>:</h4>
<p><code>const</code> operands are substituted into the asm string before being passed to LLVM.</p>



<a name="224650985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224650985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224650985">(Jan 31 2021 at 15:54)</a>:</h4>
<p>ah, im not using const currently</p>



<a name="224651001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224651001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224651001">(Jan 31 2021 at 15:55)</a>:</h4>
<p>Have a look at compiler/rustc_codegen_llvm/src/asm.rs.</p>



<a name="224651090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224651090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224651090">(Jan 31 2021 at 15:57)</a>:</h4>
<p>Ah <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_llvm/src/asm.rs#L234">https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_llvm/src/asm.rs#L234</a></p>



<a name="224651177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224651177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224651177">(Jan 31 2021 at 15:59)</a>:</h4>
<p>global_asm looks so bare in contrast <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_llvm/src/asm.rs#L332">https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_llvm/src/asm.rs#L332</a></p>



<a name="224652051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/224652051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#224652051">(Jan 31 2021 at 16:10)</a>:</h4>
<p>So it would need to generate a template, like inlineasm does. hard to say how much code can be shared, since I guess only <code>sym</code> and <code>const</code> make sense for global_asm</p>



<a name="225426992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225426992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225426992">(Feb 06 2021 at 19:41)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> do you think this just "works" accidentally? <a href="https://godbolt.org/z/r8nvxb">https://godbolt.org/z/r8nvxb</a></p>



<a name="225427741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225427741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225427741">(Feb 06 2021 at 20:00)</a>:</h4>
<p>I know some code in the Linux kernel relies on this, so clang had to support it.</p>



<a name="225427817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225427817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225427817">(Feb 06 2021 at 20:02)</a>:</h4>
<p>However this shouldn't be something that we guarantee since we want to be able to assemble each global_asm individually using an external assembler.</p>



<a name="225427928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225427928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225427928">(Feb 06 2021 at 20:04)</a>:</h4>
<p>I see, since I probably won't use cranelift, maybe I will just use it, especially if Linux with clang uses it</p>



<a name="225428078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225428078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225428078">(Feb 06 2021 at 20:08)</a>:</h4>
<p>i can only find MIPs doing that in the kernel, didn't know that built with clang, thought it was just x86/arm</p>



<a name="225428148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225428148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225428148">(Feb 06 2021 at 20:10)</a>:</h4>
<p>does that actually work even within the single file? I suspect rust is free to split that file up into multiple codegen units and make the global assembly item appear in a different unit than the function that uses the macro from it.</p>



<a name="225428150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225428150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225428150">(Feb 06 2021 at 20:10)</a>:</h4>
<p>^ that is exactly what I wanted to say :)</p>



<a name="225428156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225428156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225428156">(Feb 06 2021 at 20:10)</a>:</h4>
<p>regardless, a great thing to note in the global_asm tracking issue.</p>



<a name="225428171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225428171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225428171">(Feb 06 2021 at 20:11)</a>:</h4>
<p>cg_clif probably supports it if it ends up in the same cgu. At least for as long as the mono item of <code>global_asm!</code> comes before that of the function in the same cgu.</p>



<a name="225428233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225428233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225428233">(Feb 06 2021 at 20:13)</a>:</h4>
<p>cg_clif turns all <code>asm!</code> into a call to a generated assembly function. this is combined with all <code>global_asm!</code> in the same cgu and passed to an external assembler.</p>



<a name="225428237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225428237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225428237">(Feb 06 2021 at 20:13)</a>:</h4>
<p>yeah, I was thinking about trying a high codegen-units to see if I could break it</p>



<a name="225428357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225428357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225428357">(Feb 06 2021 at 20:16)</a>:</h4>
<p>the alternative is duplicating the BAR constant into asm, and having runtime checks that they're the same :(</p>



<a name="225428358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225428358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225428358">(Feb 06 2021 at 20:16)</a>:</h4>
<p>Currently modules are never split into multiple cgus. This is not guaranteed. For example for cg_clif I would like an option to put every function in it's own cgu for better incrementality.</p>



<a name="225428390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225428390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225428390">(Feb 06 2021 at 20:17)</a>:</h4>
<p>Why duplicating BAR? I thought we were talking about the macro.</p>



<a name="225428443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225428443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225428443">(Feb 06 2021 at 20:18)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/81838">https://github.com/rust-lang/rust/issues/81838</a></p>



<a name="225428448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225428448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225428448">(Feb 06 2021 at 20:19)</a>:</h4>
<p>well I mean, I need to use the macro, I dont want to duplicate that code, so I'd have to do everything inside global_asm, so BAR would be in rust and asm</p>



<a name="225428510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225428510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225428510">(Feb 06 2021 at 20:20)</a>:</h4>
<p>Ah, ok</p>



<a name="225428790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225428790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225428790">(Feb 06 2021 at 20:28)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> I replied</p>



<a name="225429892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225429892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225429892">(Feb 06 2021 at 20:58)</a>:</h4>
<p>I think even <code>asm!</code> can leak macro definitions into other <code>asm!</code> blocks. But you have no control over how these are ordered in the final output, so it's not reliable.</p>



<a name="225429911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225429911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225429911">(Feb 06 2021 at 20:59)</a>:</h4>
<p>I don't think this is something that we can really control.</p>



<a name="225429974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225429974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225429974">(Feb 06 2021 at 21:00)</a>:</h4>
<p>Functions containing <code>asm!</code> could get a new cgu each in debug mode. That should at least make it clear that it isn't really supported.</p>



<a name="225430976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225430976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225430976">(Feb 06 2021 at 21:26)</a>:</h4>
<p>My primary concern here is that this could block future improvements to the collector after asm!/global_asm! stabilizes.</p>



<a name="225431306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225431306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225431306">(Feb 06 2021 at 21:36)</a>:</h4>
<p>collector?</p>



<a name="225431367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225431367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225431367">(Feb 06 2021 at 21:37)</a>:</h4>
<p>Its the component of the compiler that divides a crate into smaller units of work to enable parallel codegen etc.</p>



<a name="225431424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225431424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225431424">(Feb 06 2021 at 21:39)</a>:</h4>
<p>Simplified, you could think of it as an automated version of the thing where developers split their C/C++ codebase into <code>.c</code> or <code>cpp</code> files and build a <code>.o</code> out of them in parallel before linking the <code>.o</code>s  together</p>



<a name="225431667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/global_asm%20with%20format_specifiers/near/225431667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/global_asm.20with.20format_specifiers.html#225431667">(Feb 06 2021 at 21:45)</a>:</h4>
<p>Ah!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>